﻿using System.Text;
using System.Data;
using DBUtility;//请先添加引用

namespace OracleDAL.Topo
{
    /// <summary>
    /// 数据访问类InformationUtilization。
    /// </summary>
    public class InformationUtilization
    {
        public InformationUtilization()
        { }
        #region  成员方法

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string LOGISN)
        {
            return true;
        }
        /// <summary>
        /// 获取视频信息
        /// </summary>
        /// <param name="USERISN">用户ISN</param>
        /// <returns></returns>
       /* public DataSet GetVideo(string USERISN)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("select USERISN,IP,CHANNEL,USERNAME,PWD,ROOMID");
            sb.Append(" from RECORDVIDEO ");
            sb.Append(" where USERISN='" + USERISN + "'");
            return OracleHelper.Query(sb.ToString());
        }*/
        /// <summary>
        /// 获取重点监控方案信息
        /// </summary>
        /// <param name="PROGRAMID">方案ID</param>
        /// <returns></returns>
        /*public DataSet GetProgram(string PROGRAMID)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("select ID,PROGRAMNAME,SHORTNAME,ISUSED,RECORDTIME,CREATEUSER,REMARK ");
            sb.Append(" from PROGRAMCONFIG ");
            sb.Append(" where ID='" + PROGRAMID + "'");
            return OracleHelper.Query(sb.ToString());
        }*/
        /// <summary>
        /// 获取重点监控方案下选基站ID列表
        /// </summary>
        /// <param name="PROGRAMID">方案ID</param>
        /// <returns></returns>
        /*public DataSet GetProgramTBSList(string PROGRAMID)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("select ID,PROGRAMID,TBSNEID ");
            sb.Append(" from PROGRAMCONFIGTBS ");
            sb.Append(" where PROGRAMID='" + PROGRAMID + "'");
            return OracleHelper.Query(sb.ToString());
        }*/
        /// <summary>
        /// 更新方案可用，唯一性
        /// </summary>
        /// <param name="PROGRAMID">方案ID</param>
        /// <returns></returns>
       /* public int SetProgramUsed(string PROGRAMID)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(" declear ");
            sb.Append(" begin ");
            sb.Append(" update PROGRAMCONFIG set ISUSED='0' ;");
            sb.Append(" update PROGRAMCONFIG set ISUSED='1' where  ID='" + PROGRAMID + "';");
            sb.Append(" end;");
            return OracleHelper.ExecuteSql(sb.ToString());
        }*/
        /// <summary>
        /// 删除方案
        /// </summary>
        /// <param name="PROGRAMID">方案ID</param>
        /// <returns></returns>
       /* public int DeleteProgramUsed(string PROGRAMID)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(" delete PROGRAMCONFIG set ISUSED='1' where  ID='" + PROGRAMID + "'");
            return OracleHelper.ExecuteSql(sb.ToString());
        }*/
        /// <summary>
        /// 更新方案下的基站ID列表
        /// </summary>
        /// <param name="strSQL">需要执行的sql语句</param>
        /// <returns></returns>
       /* public int UpdateProgramTBSList(string strSQL) {
            return OracleHelper.ExecuteSql(strSQL);
        }*/
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Model.SystemManager.SEC_LOGONLOG model)
        {

        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Model.SystemManager.SEC_LOGONLOG model)
        {
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(string LOGISN)
        {

        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Topo.InformationUtilization GetModel(string LOGISN)
        {
            return new Model.Topo.InformationUtilization();
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return new DataSet();
        }
        ///// <summary>
        ///// 获取基站信道占用情况数据
        ///// </summary>
        ///// <param name="TBSID">基站ID，如果为空就返回所有基站的基站信道占用情况</param>
        ///// <returns></returns>
        //public DataSet GetChannelUse(string TBSID)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select NEID,UNIT,TSL0,TSL1,TSL2,TSL3,DXT_TSL0,DXT_TSL1,DXT_TSL2,DXT_TSL3,MAX(TIME_STAMP) from RADIO_CHANNEL ");
        //    if (TBSID.Length != 0)
        //    {
        //        strSql.Append(" where NEID='" + TBSID + "'");
        //    }
        //    strSql.Append(" group by UNIT ");
        //    return new Common.mysqldata().GetList(strSql.ToString(), "");
        //}
        /// <summary>
        /// 获取方案列表
        /// </summary>
        /// <param name="PROGRAMID"></param>
        /// <param name="PROGRAMTYPE"></param>
        /// <returns></returns>
        public DataSet GetProgramList(string PROGRAMID, string PROGRAMTYPE)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(" select ID,PROGRAMNAME,SHORTNAME,ISUSED,RECORDTIME,CREATEUSER,REMARK,PROGRAMTYPE ");
            sb.Append(" from programconfig ");
            string strWhere = string.Empty;
            if (PROGRAMID.Length > 0)
            {
                strWhere = " ID='" + PROGRAMID + "'";
            }
            if (PROGRAMTYPE.Length > 0)
            {
                if (strWhere.Length > 0)
                {
                    strWhere += " and ";
                }
                strWhere += " PROGRAMTYPE ='" + PROGRAMTYPE + "'";
            }
            if (strWhere.Length > 0)
            {
                sb.Append(" where " + strWhere);
            }
            sb.Append(" order by PROGRAMNAME ");
            //return OracleHelper.Query(sb.ToString());
            return MySQLHelper.ExecuteDataset(CommandType.Text, sb.ToString());
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="SQL"></param>
        /// <returns></returns>
        public int ExcelSQL(string SQL)
        {
            //return OracleHelper.ExecuteSql(SQL);
            return MySQLHelper.ExecuteNonQuery(CommandType.Text, SQL);
        }
        #endregion  成员方法
    }
}
